# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html

import scrapy


class WeiboItem(scrapy.Item):
    # define the fields for your item here like:
    # name = scrapy.Field()
    username = scrapy.Field() # 姓名
    userid= scrapy.Field() # 唯一字段,筛选是否重复
    verified_reason = scrapy.Field() # 微博认证
    followers_count = scrapy.Field() # 粉丝
    follow_count = scrapy.Field() # 关注
    def save_to_mysql(self):
        sql = 'insert into sina_weibo(username,userid,verified_reason,followers_count,follow_count)' \
              'values(%s,%s,%s,%s,%s)'
        data=(self['username'],self['userid'],self['verified_reason'],self['followers_count'],self['follow_count'])
        return sql,data
